package com.happyhome.datamodel;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * 
 * @author PC
 *
 */

@Entity
@Table(name = "NEWS")
public class News implements Serializable {
    
	private static final long serialVersionUID = 1L;
	
	private Long idNews;
    private String titleNews;
    private String content;
    private Image imageThumbnail;
    private Boolean status;
    private Date makeDate;
    private Boolean isDisplay;
    @Transient
    private String thumbnailUrl;
    
    public News() {}

    @Id
	@Column(name="ID_NEWS")
    @GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getIdNews() {
		return idNews;
	}

	public void setIdNews(Long idNews) {
		this.idNews = idNews;
	}

	@Column(name="TITLE_NEWS")
	public String getTitleNews() {
		return titleNews;
	}

	public void setTitleNews(String titleNews) {
		this.titleNews = titleNews;
	}

	@Column(name="CONTENT")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@OneToOne
	@JoinColumn(name="IMAGE_THUMBNAIL")
	public Image getImageThumbnail() {
		return imageThumbnail;
	}

	public void setImageThumbnail(Image imageThumbnail) {
		this.imageThumbnail = imageThumbnail;
	}

	@Column(name="STATUS")
	public Boolean getStatus() {
		return status;
	}

	public void setStatus(Boolean status) {
		this.status = status;
	}
	
	@Column(name="IS_DISPLAY")
	public Boolean getIsDisplay() {
		return isDisplay;
	}

	public void setIsDisplay(Boolean isDisplay) {
		this.isDisplay = isDisplay;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="MAKE_DATE")
	public Date getMakeDate() {
		return makeDate;
	}

	public void setMakeDate(Date makeDate) {
		this.makeDate = makeDate;
	}

	@Transient
    public String getThumbnailUrl() {
        return thumbnailUrl;
    }

    /**
     * @param thumbnailUrl the thumbnailUrl to set
     */
    public void setThumbnailUrl(String thumbnailUrl) {
        this.thumbnailUrl = thumbnailUrl;
    }
}
